package com.lyp.qczp.contoller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lyp.qczp.entity.Remunera;
import com.lyp.qczp.service.RemuneraService;

@RestController
@CrossOrigin(origins = "*")
public class RemuneraContoller {
	@Autowired
	private RemuneraService remuneraService; 
	/**
	 * 
	 * @param 
	 * @return 1位删除成功，0是删除失败
	 */
	@PostMapping("/deleteRemuneraById")
	public int deleteRemuneraById(Integer reId) {
		return remuneraService.deleteById(reId);
	}
	/**
	 * 分页查询机构
	 * @param page 分页参数
	 * @param rows 分页参数
	 * @return 查询的数据 
	 */
	@PostMapping("/findRemunera")
	public Map<String, Object> findBumen(Integer page, Integer rows,Remunera remunera) {
		
		PageRequest pageable = PageRequest.of(page - 1, rows);
		Map<String, Object> findAll = remuneraService.findAll(pageable,remunera);
		System.out.println(findAll);
		return findAll;

	}
	
	/**
	 * 增加&修改
	 * @param 
	 * @return 1成功，0失败,
	 */
	@PostMapping("/saveRemunera")
	public int savebumen(Remunera remunera) {
		return remuneraService.save(remunera);
	}
}
